text: Fix selection bubble handling
authorMatthias Clasen <mclasen@redhat.com>
Mon, 10 Jun 2019 21:40:14 +0000 (21:40 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 11 Jun 2019 17:46:01 +0000 (17:46 +0000)
Same fix as the previous commit.

gtk/gtktext.c

index ecff9f69da2fafec883f74187ed7a35f0fac8320..f89b8555f43ac015117863ede46f49cb9c0ab9d5 100644 (file)
@@ -1804,7 +1804,7 @@ gtk_text_finalize (GObject *object)
 
   g_clear_object (&priv->cached_layout);
   g_clear_object (&priv->im_context);
-  g_clear_pointer (&priv->selection_bubble, gtk_widget_destroy);
+  g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
   g_clear_pointer (&priv->magnifier_popover, gtk_widget_destroy);
   g_clear_object (&priv->text_handle);
   g_free (priv->im_module);
@@ -5833,8 +5833,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
       return G_SOURCE_REMOVE;
     }
 
-  if (priv->selection_bubble)
-    gtk_widget_destroy (priv->selection_bubble);
+  g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
 
   priv->selection_bubble = gtk_popover_new (GTK_WIDGET (self));
   gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),